home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Mp / fgmp-1.0b5 / gmp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-09  |  4.1 KB  |  105 lines

  1. /*
  2.  * FREE GMP - a public domain implementation of a subset of the 
  3.  *           gmp library
  4.  *
  5.  * I hearby place the file in the public domain.
  6.  *
  7.  * Do whatever you want with this code. Change it. Sell it. Claim you
  8.  *  wrote it. 
  9.  * Bugs, complaints, flames, rants: please send email to 
  10.  *    Mark Henderson <markh@wimsey.bc.ca>
  11.  * I'm already aware that fgmp is considerably slower than gmp
  12.  *
  13.  * CREDITS:
  14.  *  Paul Rouse <par@r-cube.demon.co.uk> - generic bug fixes, mpz_sqrt and
  15.  *    mpz_sqrtrem, and modifications to get fgmp to compile on a system 
  16.  *    with int and long of different sizes (specifically MSDOS,286 compiler)
  17.  *  Also see the file "notes" included with the fgmp distribution, for
  18.  *    more credits.
  19.  *
  20.  * VERSION 1.0 - beta 5
  21.  */
  22.  
  23. #include <stdio.h>
  24. #include <sys/types.h>
  25.  
  26. /* for malloc and free */
  27. #include <stdlib.h>
  28.  
  29. #ifndef NULL
  30. #define NULL ((void *)0)
  31. #endif
  32.  
  33. typedef long mp_limb;
  34. typedef unsigned mp_size;
  35.  
  36. typedef struct mp_int {
  37.     mp_limb *p;
  38.     short sn;
  39.     mp_size sz;
  40. } MP_INT;
  41.  
  42. #ifdef __STDC__
  43. #define PROTO(x) x
  44. #else
  45. #define PROTO(x) ()
  46. #endif
  47.  
  48. void mpz_init PROTO((MP_INT *s));
  49. void mpz_init_set PROTO((MP_INT *s, MP_INT *t));
  50. void mpz_init_set_ui PROTO((MP_INT *s, unsigned long v));
  51. void mpz_init_set_si PROTO((MP_INT *y, long v));
  52. void mpz_clear PROTO((MP_INT *s));
  53. void _mpz_realloc PROTO((MP_INT *x, mp_size size));
  54. void mpz_set PROTO((MP_INT *y, MP_INT *x));
  55. void mpz_set_ui PROTO((MP_INT *y, unsigned long v));
  56. unsigned long mpz_get_ui PROTO((MP_INT *y));
  57. long mpz_get_si PROTO((MP_INT *y));
  58. void mpz_set_si PROTO((MP_INT *y, long v));
  59. int mpz_cmp PROTO((MP_INT *x, MP_INT *y));
  60. void mpz_mul PROTO((MP_INT *ww,MP_INT *u, MP_INT *v));
  61. void mpz_mul_2exp PROTO((MP_INT *z, MP_INT *x, unsigned long e));
  62. void mpz_div_2exp PROTO((MP_INT *z, MP_INT *x, unsigned long e));
  63. void mpz_mod_2exp PROTO((MP_INT *z, MP_INT *x, unsigned long e));
  64. void mpz_add PROTO((MP_INT *zz,MP_INT *x,MP_INT *y));
  65. void mpz_add_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  66. void mpz_mul_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  67. void mpz_sub PROTO((MP_INT *z,MP_INT *x, MP_INT *y));
  68. void mpz_sub_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  69. void mpz_div PROTO((MP_INT *q, MP_INT *x, MP_INT *y));
  70. void mpz_mdiv PROTO((MP_INT *q, MP_INT *x, MP_INT *y));
  71. void mpz_mod PROTO((MP_INT *r, MP_INT *x, MP_INT *y));
  72. void mpz_divmod PROTO((MP_INT *q, MP_INT *r, MP_INT *x, MP_INT *y));
  73. void mpz_mmod PROTO((MP_INT *r, MP_INT *x, MP_INT *y));
  74. void mpz_mdivmod PROTO((MP_INT *q,MP_INT *r, MP_INT *x, MP_INT *y));
  75. void mpz_mod_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  76. void mpz_mmod_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  77. void mpz_div_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  78. void mpz_mdiv_ui PROTO((MP_INT *x,MP_INT *y, unsigned long n));
  79. void mpz_divmod_ui PROTO((MP_INT *q,MP_INT *x,MP_INT *y, unsigned long n));
  80. void mpz_mdivmod_ui PROTO((MP_INT *q,MP_INT *x,MP_INT *y, unsigned long n));
  81. unsigned int mpz_sizeinbase PROTO((MP_INT *x, int base));
  82. char *mpz_get_str PROTO((char *s,  int base, MP_INT *x));
  83. int mpz_set_str PROTO((MP_INT *x, char *s, int base));
  84. int mpz_init_set_str PROTO((MP_INT *x, char *s, int base));
  85. void mpz_random PROTO((MP_INT *x, mp_size size));
  86. void mpz_random2 PROTO((MP_INT *x, mp_size size));
  87. size_t mpz_size PROTO((MP_INT *x));
  88. void mpz_abs PROTO((MP_INT *, MP_INT *));
  89. void mpz_neg PROTO((MP_INT *, MP_INT *));
  90. void mpz_fac_ui PROTO((MP_INT *, unsigned long));
  91. void mpz_gcd PROTO((MP_INT *, MP_INT *, MP_INT *));
  92. void mpz_gcdext PROTO((MP_INT *, MP_INT *, MP_INT *, MP_INT *, MP_INT *));
  93. int mpz_jacobi PROTO((MP_INT *, MP_INT *));
  94. int mpz_cmp_ui PROTO((MP_INT *, unsigned long));
  95. int mpz_cmp_si PROTO((MP_INT *, long));
  96. void mpz_and PROTO((MP_INT *, MP_INT *, MP_INT *));
  97. void mpz_or PROTO((MP_INT *, MP_INT *, MP_INT *));
  98. void mpz_xor PROTO((MP_INT *, MP_INT *, MP_INT *));
  99. void mpz_pow_ui PROTO((MP_INT *, MP_INT *, unsigned long));
  100. void mpz_powm PROTO((MP_INT *, MP_INT *, MP_INT *, MP_INT *));
  101. void mpz_powm_ui PROTO((MP_INT *, MP_INT *, unsigned long, MP_INT *));
  102. int mpz_probab_prime_p  PROTO((MP_INT *, int));
  103. void mpz_sqrtrem PROTO((MP_INT *, MP_INT *, MP_INT *));
  104. void mpz_sqrt PROTO((MP_INT *, MP_INT *));
  105.